import { Form, Input, Select, Switch } from 'antd';
import type React from 'react';

interface CardInfoFormProps {
  isEditMode?: boolean;
}

const CardInfoForm: React.FC<CardInfoFormProps> = ({ isEditMode = false }) => {
  return (
    <>
      {!isEditMode && (
        <Form.Item
          label="卡号"
          name="cardID"
          rules={[{ required: true, message: '请输入卡号' }]}
        >
          <Input />
        </Form.Item>
      )}
      <Form.Item
        label="客户ID"
        name="customerID"
        rules={[{ required: true, message: '请输入客户ID' }]}
      >
        <Input type="number" disabled={isEditMode} />
      </Form.Item>
      <Form.Item
        label="储蓄类型"
        name="savingID"
        rules={[{ required: true, message: '请选择储蓄类型' }]}
      >
        <Select>
          <Select.Option value={1}>活期</Select.Option>
          <Select.Option value={2}>定期一年</Select.Option>
          <Select.Option value={3}>定期二年</Select.Option>
          <Select.Option value={4}>定期三年</Select.Option>
          <Select.Option value={5}>定活两便</Select.Option>
          <Select.Option value={6}>零存整取一年</Select.Option>
          <Select.Option value={7}>零存整取二年</Select.Option>
          <Select.Option value={8}>零存整取三年</Select.Option>
        </Select>
      </Form.Item>
      <Form.Item
        label="货币类型"
        name="curID"
        rules={[{ required: true, message: '请输入货币类型' }]}
      >
        <Input />
      </Form.Item>
      {isEditMode && (
        <Form.Item label="开卡日期" name="openDate">
          <Input disabled />
        </Form.Item>
      )}
      <Form.Item
        label="开卡金额"
        name="openMoney"
        rules={[{ required: true, message: '请输入开卡金额' }]}
      >
        <Input type="number" disabled={isEditMode} />
      </Form.Item>
      <Form.Item
        label="余额"
        name="balance"
        rules={[{ required: true, message: '请输入余额' }]}
      >
        <Input type="number" />
      </Form.Item>
      <Form.Item
        label="密码"
        name="pass"
        rules={isEditMode ? [] : [{ required: false }]}
      >
        <Input.Password
          placeholder={isEditMode ? '留空则不修改密码' : '可选'}
        />
      </Form.Item>
      {isEditMode && (
        <Form.Item label="是否挂失" name="IsReportLoss" valuePropName="checked">
          <Switch />
        </Form.Item>
      )}
    </>
  );
};

export default CardInfoForm;
